<!DOCTYPE HTML>
<html class="error-page no-js" lang="zh_CN">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">

<title>可视化表单设计器2.0</title> #required_css
</head>

<body>
	<div class="center-wrapper">
		<div class="center-content text-center">
			<div class="row no-m">
				<div class="col-xs-10 col-xs-offset-2 col-sm-10 col-sm-offset-6 col-md-6 col-md-offset-3">
					<form action="$!basePath/bi/form/v2/design" method="post" onsubmit = "return checkSelect()">
						<section class="panel bg-white no-b fadeIn animated shadow">
							<div class="panel-heading">
								<h4>选择数据表</h4>
							</div>
							<div class="panel-body text-left" style="height:300px; overflow: scroll; overflow-x: hidden;">
								<table class="table">
									<thead>
										<tr>
											<th class="col-lg-1">选择</th>
											<th class="col-lg-4">表注释</th> 
											<th class="col-lg-4">表名</th>
											<th>设为主表</th>
										</tr>
									</thead>
									<tbody>
										#foreach($!obj in $!list)
										<tr>
											<td>
												<input type="checkbox" name="tables" value="$!obj.get(0)" onchange="selectTable(this)"/>
											</td>
											<td>$!obj.get(1)</td>
											<td>$!obj.get(0)</td>
											<td>
												<input type="radio" name="primary" value="$!obj.get(0)" disabled="disabled"/>
											</td>
										</tr>
										#end
									</tbody>
								</table>
							</div>
							<div class="panel-footer">
								<button class="btn btn-primary btn-block">确    定</button>
							</div>
						</section>
					</form>
				</div>
			</div>
		</div>
	</div>
	#required_js
	<script type="text/javascript">
		function selectTable(chk){
			if($(chk).is(":checked")){
				$(chk).parent().parent().find("input:radio").removeAttr("disabled");
			}else{
				$(chk).parent().parent().find("input:radio").attr("disabled", "disabled");
			}
		}
		function checkSelect(){
			var len = $("form input:checked").length;
			if(len == 0){
				alert("至少需要选择一张表！");
				return false;
			}else{
				if(len > 1 && $("form input:radio:checked").length == 0){
					alert("请选择主表！");
					return false;
				}
			}
			return true;
		}
	</script>
</body>
</html>